/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


$(document).ready(function () {

    var mycolumns = [
        {title: '商品照片', filed: 'uimage'},
        {title: '商品名称', filed: 'uname'},
        {title: '价格', filed: 'uprice'},
        {title: '商品数量', filed: 'unum'},
        {title: '操作',field: 'operate',
 
                    width: 100,
 
                    align: 'center',
 
                    valign: 'middle',
 
                    
 
                    },
        
    ];
    $('#myTable').bootstrapTable('destroy');   //动态加载表格之前，先销毁表格

    $('#myTable').bootstrapTable({//表格初始化
        columns: mycolumns, //表头
        //通过ajax返回的数据
        width: 300,
        height: 500,
        method: 'get',
        pageSize: 5,
        pageNumber: 1,
        pageList: [],
        cache: false,
        striped: true,
        pagination: true,
        sidePagination: 'client',
        search: false,
        showRefresh: false,
        showExport: false,
        showFooter: true,
        // exportTypes: ['csv', 'txt', 'xml'],
        clickToSelect: true,
    });


    $(".shanchu").click(function () {
       
                    $.ajax({
                        url: 'deleteBasket',
                        type: 'GET',
                        data: {shopId:$("input").attr("value")},
                        success: function (data) {
                            
                            if (1 == data) {
                                 alert("删除成功");
                                 
                            } else {
                                alert("删除错误");
                            }
                        },
                        error: function () {
                            alert("出现错误");
                        }
                    })
                });
                
                
                $(".jiesuan").click(function () {
       
                    $.ajax({
                        url: 'settleAccounts',
                        type: 'GET',
                        data: {shopPrice:$("#jiage").val()},
                        success: function (data) {
                            
                            window.location.href="pay.jsp?sum="+data;
                        },
                        error: function () {
                            alert("出现错误");
                        }
                    })
                });


})

